package com.edmendst.xmall.service.impl;

import com.edmendst.xmall.mapper.CategoryMapper;
import com.edmendst.xmall.pojo.CategoryExample;
import com.edmendst.xmall.service.CategoryService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public int selectCategoryIdByCategoryName(String categoryName) {
        CategoryExample categoryExample = new CategoryExample();
        categoryExample.createCriteria().andCategoryNameEqualTo(categoryName);
        return categoryMapper.selectByExample(categoryExample).get(0).getCategoryId();
    }
}
